/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */


package post;
import java.util.*;


/**
 *
 * @author Danny
 */
public class ProductCatalog {
    Hashtable<String, ProductSpec> catalog;
    
    public ProductCatalog(){
        catalog = new Hashtable<String, ProductSpec>();
    }
    
    void addToProductCatalog(String upcKey, ProductSpec value){
        catalog.put(upcKey, value);
    }
    
    ProductSpec getProductSpec(String upc){
        return catalog.get(upc);
    }
    
    boolean hasProduct(String upc){
        return catalog.containsKey(upc);
    }
    
    Enumeration getAllUPC(){
        return catalog.keys();
    }
    
    Collection getAllProductSpec(){
        return catalog.values();
    }
    
    /*
    public static void main(String args[]){
        //Test cases
        ProductSpec test = new ProductSpec("hi", 1.25, "icecream");
        ProductCatalog testtwo = new ProductCatalog();
        testtwo.addToProductCatalog("icecream", test);
        
        //Test hasProduct method
        System.out.println(testtwo.hasProduct("icecream"));
        
        //Test getAllUPC method
        Enumeration e = testtwo.getAllUPC();
        if (e.hasMoreElements()){
            System.out.println(e.nextElement());
        }
    }
        */
    
   
}
